{extend name="public:base"}
{block name="body"}
<div class="row">
    <div class="col-md-8">
        <h2>用户登录</h2>
        <form action="{:url('index/index/save')}" method="post" id="login" enctype="multipart/form-data">
            <input type="hidden" name="user_id" value="{$Think.session.user_id}">
            <div class="form-group row">
                <label for="title" class="col-sm-2 col-form-label">标题</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="title" placeholder="请输入文章标题" name="title">
                </div>
            </div>

            <div class="form-group row">
                <label  class="col-sm-2 col-form-label">分类</label>
                <div class="col-sm-10">
                    <select class="form-control" name="cate_id">
                        {volist name="cateList" id="cate"}
                        <option value="{$cate.id}">{$cate.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label  class="col-sm-2 col-form-label">内容</label>
                <div class="col-sm-10">
                    <textarea class="form-control" name="content" id="" style="height: 250px"></textarea>
                </div>
            </div>
            <div class="form-group row">
                <label  class="col-sm-2 col-form-label">标题图片</label>
                <div class="col-sm-10">
                    <input type="file" name="title_image" class="form-control" placeholder="标题图片">
                </div>
            </div>
            <div class="form-group row ">
                <label  class="col-sm-2 col-form-label"></label>
                <div class="col-sm-10">
                    <button type="submit" class="btn btn-primary mb-2" id="register">保存</button>
                </div>
            </div>


        </form>
    </div>
    <script>
        KindEditor.ready(function(K) {

            var editor1 = K.create('textarea[name="content"]', {
                width : '100%',
                cssPath : '/kindeditor/plugins/code/prettify.css',
                uploadJson : "{:url('index/index/upload')}",
                fileManagerJson : "{:url('index/index/upload')}",
                allowFileManager : true,
            });
            prettyPrint();
        });
    </script>
    {/block}